import 'package:flutter/material.dart';

class DishWidget extends StatelessWidget {
  const DishWidget(
      {super.key,
      required this.dishName,
      this.onTapDown,
      this.onTap,
      this.longPress,
      this.onTapUp,
      this.childWidget});

  final String dishName;
  final void Function(TapDownDetails details)? onTapDown;
  final void Function()? longPress;
  final void Function()? onTap;
  final void Function(TapUpDetails details)? onTapUp;
  final Widget? childWidget;

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onLongPress: longPress,
      onTapDown: onTapDown,
      onTap: onTap,
      onTapUp: onTapUp,
      child: Column(
        children: [
          Container(
            padding: EdgeInsets.only(top: 15, left: 10, right: 10),
            child: Column(
              children: [
                Row(
                  children: [
                    Text(
                      dishName,
                      style: TextStyle(
                        color: dishName == '添加菜品'
                            ? Color(0xff2b3d85)
                            : Colors.black,
                        fontSize: 16,
                      ),
                    ),
                  ],
                ),
                Row(
                  mainAxisAlignment: MainAxisAlignment.end,
                  children: [
                    childWidget ?? SizedBox(),
                  ],
                ),
                Container(
                  margin: EdgeInsets.only(top: 8),
                  child: Row(
                    children: [
                      Expanded(
                        child: Container(
                          height: 2,
                          color: Colors.black.withOpacity(0.3),
                        ),
                      ),
                      Container(
                        decoration: BoxDecoration(
                            shape: BoxShape.circle,
                            color: Colors.black.withOpacity(0.3)),
                        width: 6,
                        height: 6,
                      )
                    ],
                  ),
                )
              ],
            ),
          ),
          // dishNum != null
          //     ? GradientLine(colorList: [
          //         Colors.white,
          //         Color(0xffE1B4FF).withOpacity(0.8),
          //         Color(0xffFF7700).withOpacity(0.4),
          //         Colors.white,
          //       ])
          //     : SizedBox()
        ],
      ),
    );
  }
}
